export default {
  //分页混入
  data() {
    return {
      tableData: [], // 列表数据
      selectedRowKeys: [], // 选中项
      loading: false,
      params: {},
      pagination: {
        //表格分页相关配置
        current: 1,
        total: 0,
        pageSize: 20,
        defaultPageSize: 20,
        showTotal: (total) => `共 ${total} 条数据`,
        showSizeChanger: true,
        showQuickJumper: true,
        pageSizeOptions: ["10", "20", "30", "40", "50"],
        onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize),
        onChange: (page) => (this.pagination.current = page),
      },
    }
  },
  created() {
    this.getTableDataMixins()
  },
  methods: {
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys
    },
    getTableDataMixins() {
      this.getTableData()
    },
    getTableData() {},
    reset(defaultParams = {}) {
      for (const key in this.params) {
        if (Object.hasOwnProperty.call(this.params, key)) {
          this.params[key] = undefined
        }
      }

      const kyes = Object.keys(defaultParams)
      for (const element of kyes) {
        this.params[element] = defaultParams[element]
      }
      console.log(this.params)
    },
  },
}
